// ==========================================================================
// gin-sns auto gen code.
// date：2021-02-21 13:45:53 +0800 CST
// path: app/model/module/article/article_entity.go
// author：jon
// ==========================================================================

package article

import (
	"time"
)

// 数据表映射结构体
type Entity struct {
	Id              int64     `json:"id" xorm:"not null pk autoincr comment('id') bigint(20)"`
	CategoryId      int64     `json:"category_id" xorm:"comment('分类id') bigint(20)"`
	UserId          int64     `json:"user_id" xorm:"comment('用户id') bigint(20)"`
	Title           string    `json:"title" xorm:"comment('标题') varchar(255)"`
	Summary         string    `json:"summary" xorm:"comment('摘要') text"`
	Content         string    `json:"content" xorm:"comment('内容') longtext"`
	Tags            string    `json:"tags" xorm:"comment('标签') varchar(512)"`
	Recommend       int       `json:"recommend" xorm:"comment('推荐设置，数字越大越靠前') int(5)"`
	Share           int       `json:"share" xorm:"comment('') tinyint(1)"`
	ContentType     string    `json:"content_type" xorm:"comment('内容类型') varchar(32)"`
	SourceUrl       string    `json:"source_url" xorm:"comment('url') text"`
	CountView       int64     `json:"count_view" xorm:"comment('阅读数量') bigint(20)"`
	CountLike       int64     `json:"count_like" xorm:"comment('赞同数量') bigint(20)"`
	CountReward     int64     `json:"count_reward" xorm:"comment('打赏数量') bigint(20)"`
	CountFavor      int64     `json:"count_favor" xorm:"comment('收藏数量') bigint(20)"`
	CountShare      int64     `json:"count_share" xorm:"comment('分享数量') bigint(20)"`
	CountComment    int64     `json:"count_comment" xorm:"comment('评论数量') bigint(20)"`
	Status          int       `json:"status" xorm:"comment('0未审核 1正常状态 2审核未通过 3删除') tinyint(2)"`
	CreateTime      time.Time `json:"create_time" xorm:"comment('创建时间') datetime"`
	UpdateTime      time.Time `json:"update_time" xorm:"comment('更新时间') datetime"`
	LastCommentTime time.Time `json:"last_comment_time" xorm:"comment('最后评论时间') datetime"`
}

//添加文章請求结构体
type AddArticleRequest struct {
	CategoryId  int64  `form:"categoryId" `
	UserId      int64  `form:"userId" `
	Title       string `form:"title" `
	Summary     string `form:"summary" `
	Content     string `form:"content" `
	Tags        string `form:"tags" `
	Recommend   int    `form:"recommend" `
	Share       int    `form:"share" `
	ContentType string `form:"contentType" `
	SourceUrl   string `form:"sourceUrl"`
}

//新增页面请求参数
type AddReq struct {
	CategoryId   int64  `form:"categoryId" `
	UserId       int64  `form:"userId" `
	Title        string `form:"title" `
	Summary      string `form:"summary" `
	Content      string `form:"content" `
	Tags         string `form:"tags" `
	Recommend    int    `form:"recommend" `
	Share        int    `form:"share" `
	ContentType  string `form:"contentType" `
	SourceUrl    string `form:"sourceUrl" `
	CountView    int64  `form:"countView" `
	CountLike    int64  `form:"countLike" `
	CountReward  int64  `form:"countReward" `
	CountFavor   int64  `form:"countFavor" `
	CountShare   int64  `form:"countShare" `
	CountComment int64  `form:"countComment" `
	Status       int    `form:"status" binding:"required"`

	LastCommentTime time.Time `form:"lastCommentTime" `
}

//修改页面请求参数
type EditReq struct {
	Id              int64     `form:"id" binding:"required"`
	CategoryId      int64     `form:"categoryId" `
	UserId          int64     `form:"userId" `
	Title           string    `form:"title" `
	Summary         string    `form:"summary" `
	Content         string    `form:"content" `
	Tags            string    `form:"tags" `
	Recommend       int       `form:"recommend" `
	Share           int       `form:"share" `
	ContentType     string    `form:"contentType" `
	SourceUrl       string    `form:"sourceUrl" `
	CountView       int64     `form:"countView" `
	CountLike       int64     `form:"countLike" `
	CountReward     int64     `form:"countReward" `
	CountFavor      int64     `form:"countFavor" `
	CountShare      int64     `form:"countShare" `
	CountComment    int64     `form:"countComment" `
	Status          int       `form:"status" binding:"required不能为空"`
	LastCommentTime time.Time `form:"lastCommentTime" `
}

//分页请求参数
type SelectPageReq struct {
	CategoryId      int64     `form:"categoryId"`      //分类id
	UserId          int64     `form:"userId"`          //用户id
	Title           string    `form:"title"`           //标题
	Summary         string    `form:"summary"`         //摘要
	Content         string    `form:"content"`         //内容
	Tags            string    `form:"tags"`            //标签
	Recommend       int       `form:"recommend"`       //推荐设置，数字越大越靠前
	Share           int       `form:"share"`           //
	ContentType     string    `form:"contentType"`     //内容类型
	SourceUrl       string    `form:"sourceUrl"`       //url
	CountView       int64     `form:"countView"`       //阅读数量
	CountLike       int64     `form:"countLike"`       //赞同数量
	CountReward     int64     `form:"countReward"`     //打赏数量
	CountFavor      int64     `form:"countFavor"`      //收藏数量
	CountShare      int64     `form:"countShare"`      //分享数量
	CountComment    int64     `form:"countComment"`    //评论数量
	Status          int       `form:"status"`          //0未审核 1正常状态 2审核未通过 3删除
	LastCommentTime time.Time `form:"lastCommentTime"` //最后评论时间
	BeginTime       string    `form:"beginTime"`       //开始时间
	EndTime         string    `form:"endTime"`         //结束时间
	PageNum         int       `form:"pageNum"`         //当前页码
	PageSize        int       `form:"pageSize"`        //每页数
}
